﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="SaleDiscountManagement.aspx.cs" Inherits="SaleDiscount.Portal.SaleDiscountManagement" %>

<%@ Register TagPrefix="uc1" TagName="GridPager" Src="~/Controls/GridPager.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
        var userDialogSize = { width: 900, height: 750 };
        function createSaleDiscountEdit() {

            $dialog('<%=ResolveUrl("~/SaleDiscountEdit.aspx") %>?Type=0', userDialogSize, function (result) {
            
                    $get('<%=btnReload.ClientID %>').click();
                
            });
        }

        function modifySaleDiscountEdit(id) {
            $dialog('<%=ResolveUrl("~/SaleDiscountEdit.aspx") %>?Type=0&Id=' + id, userDialogSize, function (result) {
              
                    $get('<%=btnReload.ClientID %>').click();
                
            });
        }

        function deleteDemand(id) {
            $confirm('are you sure to delete?', function (result) {
                if (result) {
                    $text($get('<%=fieldCustomerId.ClientID %>'), id);
                    $get('<%=btnDeleteDemand.ClientID %>').click();
                }
            });
        }


     

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td valign="bottom">
                        <asp:Button runat="server" SkinID="Button120" ID="btnCreate" Text="Create Sale" />
                    </td>
                </tr>
            </table>
            <div style="margin-top: 10px">
                <NetDon:GridView ID="gridCustomerInfoList" runat="server" AutoGenerateColumns="False"
                    OnRowDataBound="gridOrderList_RowDataBound" AllowSorting="true">
                    <Columns>
                        <NetDon:BoundField HeaderText="Sale Name" DataField="SaleName" SortExpression="SaleName">
                        </NetDon:BoundField>
                        <NetDon:TemplateField HeaderText="# of Listings">
                            <ItemTemplate>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:BoundField HeaderText="Start Date" DataField="StartDate" SortExpression="StartDate"
                            DataFormatString="{0:MM/dd/yyyy}">
                        </NetDon:BoundField>
                        <NetDon:BoundField HeaderText="End Date" DataField="EndDate" SortExpression="EndDate"
                            DataFormatString="{0:MM/dd/yyyy}">
                        </NetDon:BoundField>
                        <NetDon:TemplateField HeaderText="Discount">
                            <ItemTemplate>
                                <%#GetDiscount(Eval("DiscountType"), Eval("DiscountRatio"))%>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:TemplateField HeaderText="Shipping" SortExpression="IsFreeShipping">
                            <ItemTemplate>
                                <%#GetShipping(Eval("IsFreeShipping"))%>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:TemplateField HeaderText="Status">
                            <ItemTemplate>
                                <%#GetStatus(Eval("StartDate"), Eval("StartDate"))%>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:TemplateField HeaderText="Action" ItemStyle-Width="80px">
                            <ItemTemplate>
                                <asp:ImageButton ID="btnEdit" Style="margin-left: 5px" ToolTip="Edit" runat="server"
                                    CommandName="Edit" SkinID="Modify" ImageAlign="AbsMiddle" CausesValidation="false" />
                              <%--  <asp:ImageButton ID="btnViewListings" Style="margin-left: 5px" ToolTip="View Listing"
                                    runat="server" CommandName="Edit" SkinID="ViewDetail" ImageAlign="AbsMiddle"
                                    CausesValidation="false" />--%>
                                      <asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" SkinID="Delete" ImageAlign="AbsMiddle"
                                    CausesValidation="false" CommandName="Delete" CommandArgument='<%# Eval("Id") %>' />
                            </ItemTemplate>
                        </NetDon:TemplateField>
                    </Columns>
                </NetDon:GridView>
                <asp:Button ID="btnReload" runat="server" SkinID="Hidden" OnClick="btnReload_Click" />
                <asp:HiddenField ID="fieldCustomerId" runat="server" />
                <asp:Button ID="btnDeleteDemand" runat="server" OnClick="btnDeleteDemand_Click" Text="Delete"
                    SkinID="Hidden" />
                <uc1:GridPager ID="PageQueryAdapter1" runat="server" TargetControlID="gridCustomerInfoList"
                    PageSize="20" OnPerformGetCondition="PageQueryAdapter1_PerformGetCondition" OnPerformGetRecordCount="PageQueryAdapter1_PerformGetRecordCount"
                    OnPerformGetPageData="PageQueryAdapter1_PerformGetPageData" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
